<style>
    #addMenu th {
        text-align: center;
        vertical-align: middle;
        border-right: 1px solid #ededed;
    }
</style>
<div class="box-body table-responsive no-padding" id="addMenu" ms-controller="addMenu">
    <table class="table table-hover">
        <tbody>
        <tr>
            <th>菜单名</th>
            <td><input type="text" class="form-control" ms-duplex="menu.name"/></td>
        </tr>
        <tr>
            <th>url</th>
            <td><input type="text" class="form-control" ms-duplex="menu.url"/></td>
        </tr>
        <tr>
            <th>状态</th>
            <td>
                <label class="radio-inline">
                    <input type="radio" name="stateLable" ms-duplex-string="menu.state" value="1">正常
                </label>
                <label class="radio-inline">
                    <input type="radio" name="stateLable" ms-duplex-string="menu.state" value="0">禁用
                </label>
            </td>
        </tr>
        <tr>
            <th>级别</th>
            <td>
                <label class="radio-inline">
                    <input type="radio" name="sexLable" ms-duplex-string="menu.level" value="-1">一级
                </label>
                <label class="radio-inline">
                    <input type="radio" name="sexLable" ms-duplex-string="menu.level" value="0">二级
                </label>
            </td>
        </tr>
        <tr ms-if="menu.level == 0">
            <th>所属模块</th>
            <td>
                <select class="form-control" ms-duplex-string="menu.parentId">
                    <option ms-repeat="topMenuData" ms-attr-value="el.id">{{el.name}}</option>
                </select>
            </td>
        </tr>
        </tbody>
    </table>
</div><!-- /.box-body -->
<script>
    $(function () {
        avalon.ready(function () {
            var addMenuVm = avalon.define({
                $id: "addMenu",
                menu: {'name':'','url':'','state':0,'level':-1,'parentId':''},
                topMenuData :[],
                init: function () {
                    menu = addMenuVm.menu;
                    $.myAjax({
                        url: "/dm/menu/topMenu",
                        onSuccess: function (data) {
                            if (data.state == 1) {
                                addMenuVm.topMenuData = data.obj;
                            }
                        }
                    });

                }
            })
            avalon.scan($('#addMenu')[0], addMenuVm);
            addMenuVm.init();
        })
    });

</script>
